package create.singleton;

/**
 * Created by hmily on 2017/9/6.
 */
public class Dog {

    private static Dog dog = new Dog() ;

    private Dog(){};

    public static Dog getDog() {
        if (null == dog) {
            synchronized (dog) {
                if (null == dog)
                    dog =  new Dog();
            }
        }
        return dog;
    }

    public void say (){
        System.out.println("won won");
    }
}
